import socket

messages = [b'aaaaaaaaaaa',
            b'bbbbbbbbbbb',
            b'ccccccccccc']

server_address = ('localhost', 9999)

sock = [socket.socket(socket.AF_INET, socket.SOCK_STREAM) for i in range(1000)
        ]

for s in sock:
    s.connect(server_address)

for message in messages:
    for s in sock:
        s.send(message)

    for s in sock:
        data = s.recv(1024)

        if not data:
            print('closing socket')

            s.close()